Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | SOFTWARE & RESEARCH4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : ORIX App Universe8 * File : src/app/[locale]/compare/page.tsx9 * Module : app10 * Repository : https://git.spboucher.ai/orix-spboucher-ai11 * Project Website : https://www.orixlab.dev12 * Created : 2026-11-2113 * Last Modified : 2026-11-2114 *15 * Author : Simon-Pierre Boucher16 * Position : Professor of Finance17 * Institution : Université du Québec en Outaouais (UQO)18 * Organization : SP Boucher19 * Website : https://spboucher.ai20 * Git : https://git.spboucher.ai21 *22 * Preferred Contact: support@spboucher.ai23 * Development : dev@spboucher.ai24 * Support : support@spboucher.ai25 * Security/Admin : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import type { Metadata } from "next";44import Link from "next/link";45import { AppIcon } from "@/components/ui/AppIcon";46import { StatusBadge } from "@/components/ui/Badges";47import { listApps } from "@/lib/catalog";48import { dict, href, isLocale, tr, type Locale } from "@/lib/i18n";49import { latestArtifact } from "@/lib/releases/store";50import { alternates } from "@/lib/seo";51import { betaAccess } from "@/lib/testflight";52import { iconUrl } from "@/lib/view";5354export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }): Promise<Metadata> {55 const { locale } = await params; const t = dict(locale as Locale);56 return { title: t.compare.title, description: t.compare.lead, alternates: alternates("/compare", locale as Locale) };57}5859const OS = { ios: "iOS", ipados: "iPadOS", macos: "macOS" } as const;60const MAX = 4;6162export default async function Compare({ params, searchParams }: { params: Promise<{ locale: string }>; searchParams: Promise<{ apps?: string }> }) {63 const { locale: raw } = await params; const locale: Locale = isLocale(raw) ? raw : "en";64 const t = dict(locale), all = listApps();65 const asked = (await searchParams).apps?.split(",").filter((s) => all.some((r) => r.slug === s)).slice(0, MAX);66 const picked = asked?.length ? asked : all.slice(0, 3).map((r) => r.slug);67 const rows = picked.map((s) => all.find((r) => r.slug === s)!.app);68 const toggle = (slug: string) => {69 const next = picked.includes(slug) ? picked.filter((s) => s !== slug) : [...picked, slug].slice(-MAX);70 return `${href(locale, "/compare")}${next.length ? `?apps=${next.join(",")}` : ""}`;71 };72 const distribution = (a: (typeof rows)[number]) => {73 if (latestArtifact(a.slug)) return t.dl.channel.dmg;74 const b = betaAccess(a);75 if (b.kind === "join") return `${t.dl.channel.testflight} — ${t.action.testflight}`;76 if (b.kind === "soon" && b.reason === "internal-only") return t.log.channels["testflight-internal"];77 return t.compare.unreleased;78 };79 const table: [string, (a: (typeof rows)[number]) => React.ReactNode][] = [80 [t.compare.rows.purpose, (a) => tr(a.summary, locale)],81 [t.compare.rows.status, (a) => <StatusBadge status={a.status} locale={locale} />],82 [t.compare.rows.platform, (a) => a.platforms.map((p) => t.platforms[p]).join(" · ")],83 [t.compare.rows.minOS, (a) => a.platforms.filter((p) => a.minOS[p]).map((p) => `${OS[p]} ${a.minOS[p]}`).join(" · ")],84 [t.compare.rows.version, (a) => (a.status === "beta" || a.status === "available") && a.version ? <span className="mono">{a.version}</span> : t.compare.unreleased],85 [t.compare.rows.distribution, distribution],86 [t.compare.rows.offline, (a) => tr(a.specs.offline, locale)],87 [t.compare.rows.languages, (a) => a.specs.languages.map((l) => t.app.langs[l] ?? l).join(" · ")],88 [t.compare.rows.device, (a) => (a.status === "coming-soon" ? "" : a.verification.testedOnDevice ? t.compare.yes : t.compare.no)],89 [t.compare.rows.features, (a) => <ul className="grid gap-1.5">{a.features.slice(0, 5).map((f, i) => <li key={i}>{tr(f.title, locale)}</li>)}</ul>],90 ];91 return (92 <div className="wrap wrap-wide pb-10 pt-32 sm:pt-40">93 <p className="eyebrow">ORIX</p>94 <h1 className="h1 mt-5">{t.compare.title}</h1>95 <p className="lead mt-4">{t.compare.lead}</p>96 <p className="label mt-10">{t.compare.pick}</p>97 <ul className="flex flex-wrap gap-2" data-testid="compare-picker">98 {all.map(({ slug, app }) => <li key={slug}><Link href={toggle(slug)} scroll={false} className="chip" aria-current={picked.includes(slug) ? "true" : undefined} rel="nofollow">{app.name.replace(/^ORIX /, "")}</Link></li>)}99 </ul>100 <div className="scroll-x mt-10 rounded-3xl border border-line">101 <table className="w-full min-w-[46rem] border-collapse text-left text-[0.95rem]" data-testid="compare-table">102 <thead>103 <tr className="bg-surface">104 <td className="w-44 p-5" />105 {rows.map((a) => (106 <th key={a.slug} scope="col" className="p-5 align-bottom font-normal">107 <Link href={href(locale, `/apps/${a.slug}`)} className="group block"><AppIcon name={a.name} src={iconUrl(a)} size={56} /><span className="mt-3 block text-[1.05rem] font-semibold tracking-tight group-hover:underline">{a.name}</span></Link>108 </th>109 ))}110 </tr>111 </thead>112 <tbody>113 {table.map(([label, cell]) => (114 <tr key={label} className="border-t border-line align-top">115 <th scope="row" className="p-5 text-[0.85rem] font-semibold text-ink2">{label}</th>116 {rows.map((a) => <td key={a.slug} className="p-5 text-ink2 [&_.status]:text-[0.85rem]">{cell(a) || <span className="text-ink3" aria-label={t.app.spec.na}>—</span>}</td>)}117 </tr>118 ))}119 </tbody>120 </table>121 </div>122 </div>123 );124}125